cmake_minimum_required(VERSION 3.10)
project(MyProject CXX)

# 设置头文件路径
include_directories(${PROJECT_SOURCE_DIR}/include)

# 添加可执行文件
add_executable(main
    main.cpp
    src/mysql_connection_pool.cpp
    src/thread_pool.cpp
    src/database_service.cpp
)

# 找到 MySQL 库
find_library(MYSQL_LIB mysqlclient PATHS /usr/lib64/mysql NO_DEFAULT_PATH)
if(NOT MYSQL_LIB)
    message(FATAL_ERROR "MySQL library not found. Please install mysql-devel package.")
endif()

# 链接到 MySQL 库和 pthread 库
target_link_libraries(main ${MYSQL_LIB} pthread)

# 设置 C++ 标准
set_target_properties(main PROPERTIES CXX_STANDARD 17)
set_target_properties(main PROPERTIES CXX_STANDARD_REQUIRED True)